format for rendering.sh (2310B)
1 #!/bin/sh 2 3 if [ $# -ne 1 ]; then 4 echo "usage: $0 path_to_repository_root" 5 exit 1 6 fi 7 8 repo_root=$1 9 calling_dir=$PWD 10 [ $walfu_dir ] || walfu_dir=`cd "$repo_root/../WALFU"; pwd` 11 [ $tmpdir ] || tmpdir="/tmp/mi024s07_`date +%s`" 12 [ $# -eq 2 ] && tmpdir=$2 13 14 output_zip_name='PIAD07_final.zip' 15 16 mkdir -p "$tmpdir" 17 echo -n 'Copying the repository to Sources...' 18 cp -R "$repo_root" "$tmpdir/Sources" 19 echo ' done' 20 21 ln -s "$walfu_dir" "$tmpdir/WALFU" 22 23 mkdir "$tmpdir/Build" 24 cd "$tmpdir/Build" 25 26 echo -n 'Configuring Makefiles...' 27 if [ $VERBOSE ]; then 28 cmake ../Sources 29 else 30 cmake ../Sources >> /dev/null 2>&1 31 fi 32 if [ $? -ne 0 ]; then 33 echo ' FAIL' 34 exit 1 35 fi 36 echo ' done' 37 38 echo -n 'Building binaries...' 39 if [ $VERBOSE ]; then 40 make all 41 else 42 make all >> /dev/null 2>&1 43 fi 44 if [ $? -ne 0 ]; then 45 echo ' FAIL' 46 exit 1 47 fi 48 echo ' done' 49 50 echo -n 'Building documentations...' 51 if [ $VERBOSE ]; then 52 make doc 53 else 54 make doc >> /dev/null 2>&1 55 fi 56 if [ $? -ne 0 ]; then 57 echo ' FAIL' 58 exit 1 59 fi 60 echo ' done' 61 62 cd "$tmpdir" 63 64 mkdir Install 65 echo -n 'Populating Install with executables...' 66 mv 'Build/src/supervisor' 'Install/supervisor' 67 mv 'Build/src/view_ctl' 'Install/view_ctl' 68 mv 'Build/src/test_learning' 'Install/test_learning' 69 mv 'Build/src/test_serialization' 'Install/test_serialization' 70 cp 'Sources/scripts/format for rendering.sh' 'Install/format for rendering.sh' 71 cp 'Sources/scripts/setup database.sh' 'Install/setup database.sh' 72 echo ' done' 73 74 mkdir Rapports 75 echo -n 'Populating Rapports with documentations...' 76 mv 'Build/doc/specifications.pdf' 'Rapports/specifications.pdf' 77 mv 'Build/doc/operational plan.pdf' 'Rapports/operational plan.pdf' 78 mv 'Build/doc/analysis and conception.pdf' 'Rapports/analysis and conception.pdf' 79 mv 'Build/doc/slideshow.pdf' 'Rapports/slideshow.pdf' 80 mv 'Build/doc/html' 'Rapports/developer documentation' 81 cp 'Sources/README' 'Rapports/README' 82 cp 'Sources/INSTALL' 'Rapports/INSTALL' 83 echo ' done' 84 85 echo -n 'Cleaning build files...' 86 rm -rf Build 87 rm -f WALFU 88 echo ' done' 89 90 echo -n 'Zipping...' 91 if [ $VERBOSE ]; then 92 zip -r "$output_zip_name" Sources Install Rapports 93 else 94 zip -r "$output_zip_name" Sources Install Rapports >> /dev/null 2>&1 95 fi 96 echo ' done' 97 98 cd $calling_dir 99 mv "$tmpdir/$output_zip_name" "$output_zip_name" 100 101 echo -n 'Cleaning temporary files...' 102 rm -rf "$tmpdir" 103 echo ' done'